﻿using System;
using System.Collections.Generic;
using System.Text;
using ProjScan.Submodules.Custom_Rules_Check;
using ProjScan.Tools;

namespace ProjScan.ScanRule.CustomRules
{
	// Token: 0x02000208 RID: 520
	public class RuleDataTable
	{
		// Token: 0x06000F1E RID: 3870 RVA: 0x0000742C File Offset: 0x0000562C
		public RuleDataTable(string col1, string col2)
		{
			this._colInfos = new List<ColumnInfo>();
			this.columnCount = 0;
			this.Setup(col1 ?? "NULL", col2 ?? "NULL", null, null, null, null);
		}

		// Token: 0x06000F1F RID: 3871 RVA: 0x0004375C File Offset: 0x0004195C
		public RuleDataTable(string col1, string col2, string col3)
		{
			this._colInfos = new List<ColumnInfo>();
			this.columnCount = 0;
			this.Setup(col1 ?? "NULL", col2 ?? "NULL", col3 ?? "NULL", null, null, null);
		}

		// Token: 0x06000F20 RID: 3872 RVA: 0x000437AC File Offset: 0x000419AC
		public RuleDataTable(string col1, string col2, string col3, string col4)
		{
			this._colInfos = new List<ColumnInfo>();
			this.columnCount = 0;
			this.Setup(col1 ?? "NULL", col2 ?? "NULL", col3 ?? "NULL", col4 ?? "NULL", null, null);
		}

		// Token: 0x06000F21 RID: 3873 RVA: 0x00043808 File Offset: 0x00041A08
		public RuleDataTable(string col1, string col2, string col3, string col4, string col5)
		{
			this._colInfos = new List<ColumnInfo>();
			this.columnCount = 0;
			this.Setup(col1 ?? "NULL", col2 ?? "NULL", col3 ?? "NULL", col4 ?? "NULL", col5 ?? "NULL", null);
		}

		// Token: 0x06000F22 RID: 3874 RVA: 0x0004386C File Offset: 0x00041A6C
		public RuleDataTable(string col1, string col2, string col3, string col4, string col5, string col6)
		{
			this._colInfos = new List<ColumnInfo>();
			this.columnCount = 0;
			this.Setup(col1 ?? "NULL", col2 ?? "NULL", col3 ?? "NULL", col4 ?? "NULL", col5 ?? "NULL", col6 ?? "NULL");
		}

		// Token: 0x06000F23 RID: 3875 RVA: 0x000438DC File Offset: 0x00041ADC
		public void AddRow(List<object> rowList)
		{
			bool flag = this.RowCount >= 1000;
			if (flag)
			{
				Singleton<StackTraceLogger>.Instance.RecordStackTrace("通过AddRow添加的行信息过大，将只保留前1000行。");
			}
			else
			{
				bool flag2 = rowList.Count == this.columnCount;
				if (flag2)
				{
					for (int i = 0; i < rowList.Count; i++)
					{
						this._colInfos[i].AddData(rowList[i]);
					}
				}
				else
				{
					bool flag3 = rowList.Count >= this.columnCount;
					if (flag3)
					{
						throw new ColumnCountExceedsEx();
					}
					for (int j = 0; j < rowList.Count; j++)
					{
						this._colInfos[j].AddData(rowList[j]);
					}
					for (int k = rowList.Count; k < this.columnCount; k++)
					{
						this._colInfos[k].AddData(null);
					}
					Singleton<StackTraceLogger>.Instance.RecordStackTrace("通过AddRow添加的列数少于构造的表格的列数");
				}
			}
		}

		// Token: 0x06000F24 RID: 3876 RVA: 0x00007467 File Offset: 0x00005667
		public void AddRow(object r1, object r2)
		{
			this.AddRowInternal(r1, r2, null, null, null, null, 2);
		}

		// Token: 0x06000F25 RID: 3877 RVA: 0x00007478 File Offset: 0x00005678
		public void AddRow(object r1, object r2, object r3)
		{
			this.AddRowInternal(r1, r2, r3, null, null, null, 3);
		}

		// Token: 0x06000F26 RID: 3878 RVA: 0x00007489 File Offset: 0x00005689
		public void AddRow(object r1, object r2, object r3, object r4)
		{
			this.AddRowInternal(r1, r2, r3, r4, null, null, 4);
		}

		// Token: 0x06000F27 RID: 3879 RVA: 0x0000749B File Offset: 0x0000569B
		public void AddRow(object r1, object r2, object r3, object r4, object r5)
		{
			this.AddRowInternal(r1, r2, r3, r4, r5, null, 5);
		}

		// Token: 0x06000F28 RID: 3880 RVA: 0x000074AE File Offset: 0x000056AE
		public void AddRow(object r1, object r2, object r3, object r4, object r5, object r6)
		{
			this.AddRowInternal(r1, r2, r3, r4, r5, r6, 6);
		}

		// Token: 0x06000F29 RID: 3881 RVA: 0x000439FC File Offset: 0x00041BFC
		private void AddRowInternal(object r1, object r2, object r3, object r4, object r5, object r6, int dataNum)
		{
			bool flag = this.RowCount >= 1000;
			if (flag)
			{
				Singleton<StackTraceLogger>.Instance.RecordStackTrace("通过AddRow添加的行信息过大，将只保留前1000行。");
			}
			else
			{
				bool flag2 = dataNum > this.columnCount;
				if (flag2)
				{
					throw new ColumnCountExceedsEx();
				}
				bool flag3 = dataNum <= this.columnCount;
				if (flag3)
				{
					bool flag4 = this._colInfos.Count > 0;
					if (flag4)
					{
						this._colInfos[0].AddData(r1);
					}
					bool flag5 = this._colInfos.Count > 1;
					if (flag5)
					{
						this._colInfos[1].AddData(r2);
					}
					bool flag6 = this._colInfos.Count > 2;
					if (flag6)
					{
						this._colInfos[2].AddData(r3);
					}
					bool flag7 = this._colInfos.Count > 3;
					if (flag7)
					{
						this._colInfos[3].AddData(r4);
					}
					bool flag8 = this._colInfos.Count > 4;
					if (flag8)
					{
						this._colInfos[4].AddData(r5);
					}
					bool flag9 = this._colInfos.Count > 5;
					if (flag9)
					{
						this._colInfos[5].AddData(r6);
					}
					bool flag10 = dataNum < this.columnCount;
					if (flag10)
					{
						Singleton<StackTraceLogger>.Instance.RecordStackTrace("通过AddRow添加的列数少于构造的表格的列数");
					}
				}
			}
		}

		// Token: 0x06000F2A RID: 3882 RVA: 0x00043B7C File Offset: 0x00041D7C
		internal string GetColTypes()
		{
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = 0; i < this._colInfos.Count; i++)
			{
				stringBuilder.Append(this._colInfos[i].Type);
				bool flag = i != this._colInfos.Count - 1;
				if (flag)
				{
					stringBuilder.Append(",");
				}
			}
			return stringBuilder.ToString();
		}

		// Token: 0x06000F2B RID: 3883 RVA: 0x00043BFC File Offset: 0x00041DFC
		internal string GetColumnGUID()
		{
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = 0; i < 6; i++)
			{
				bool flag = this._colInfos.Count > i;
				if (flag)
				{
					stringBuilder.Append((int)this._colInfos[i].Type);
				}
				else
				{
					stringBuilder.Append(0);
				}
			}
			return stringBuilder.ToString();
		}

		// Token: 0x06000F2C RID: 3884 RVA: 0x00043C68 File Offset: 0x00041E68
		internal string GetRow(int row)
		{
			bool flag = row < 0 || row >= this._colInfos[0].Data.Count;
			string result;
			if (flag)
			{
				result = null;
			}
			else
			{
				StringBuilder stringBuilder = new StringBuilder();
				for (int i = 0; i < this._colInfos.Count; i++)
				{
					bool flag2 = this._colInfos[i].Data[row] != null;
					if (flag2)
					{
						string str = this._colInfos[i].Data[row].ToString().Replace(',', '，');
						stringBuilder.Append(ToolsHelper.QuoteString(str));
					}
					bool flag3 = i != this._colInfos.Count - 1;
					if (flag3)
					{
						stringBuilder.Append(",");
					}
				}
				result = stringBuilder.ToString();
			}
			return result;
		}

		// Token: 0x06000F2D RID: 3885 RVA: 0x00043D5C File Offset: 0x00041F5C
		internal string GetTitle()
		{
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = 0; i < this._colInfos.Count; i++)
			{
				stringBuilder.Append(ToolsHelper.QuoteString(this._colInfos[i].Name));
				bool flag = i != this._colInfos.Count - 1;
				if (flag)
				{
					stringBuilder.Append(",");
				}
			}
			return stringBuilder.ToString();
		}

		// Token: 0x06000F2E RID: 3886 RVA: 0x00043DDC File Offset: 0x00041FDC
		private void Setup(string col1, string col2, string col3, string col4, string col5, string col6)
		{
			this._colInfos.Clear();
			bool flag = col1 != null;
			if (flag)
			{
				this._colInfos.Add(new ColumnInfo(col1));
			}
			bool flag2 = col2 != null;
			if (flag2)
			{
				this._colInfos.Add(new ColumnInfo(col2));
			}
			bool flag3 = col3 != null;
			if (flag3)
			{
				this._colInfos.Add(new ColumnInfo(col3));
			}
			bool flag4 = col4 != null;
			if (flag4)
			{
				this._colInfos.Add(new ColumnInfo(col4));
			}
			bool flag5 = col5 != null;
			if (flag5)
			{
				this._colInfos.Add(new ColumnInfo(col5));
			}
			bool flag6 = col6 != null;
			if (flag6)
			{
				this._colInfos.Add(new ColumnInfo(col6));
			}
			this.columnCount = this._colInfos.Count;
		}

		// Token: 0x17000356 RID: 854
		// (get) Token: 0x06000F2F RID: 3887 RVA: 0x00043EBC File Offset: 0x000420BC
		public int RowCount
		{
			get
			{
				return this._colInfos[0].Data.Count;
			}
		}

		// Token: 0x040008EE RID: 2286
		private List<ColumnInfo> _colInfos;

		// Token: 0x040008EF RID: 2287
		public int columnCount;
	}
}
